<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 编码和解码
        //    把中文及一些页数符号进行编码  英文字符不会编码

        //    encodeURIComponent()  编码
        //    decodeURIComponent()  解码


        const str1 = 'hello,面包' ;
        console.log(encodeURIComponent(str1));


        const str2 = 'hello%2C%E9%9D%A2%E5%8C%85' ;
        console.log(decodeURIComponent(str2));

    </script>
    
</body>
</html>